package com.youi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.youi.dao.MerchantimgsDao;
import com.youi.entity.Merchantimgs;
import com.youi.model.ImgsObj;
import com.youi.service.MerchantimgsService;

@Service
public class MerchantimgsServiceImpl extends BaseServiceImpl<Merchantimgs> implements MerchantimgsService{
		
		private MerchantimgsDao merchantimgsDao;
		
		@Autowired
		public void setfaultRecordDao(MerchantimgsDao merchantimgsDao){
			this.merchantimgsDao=merchantimgsDao;
			super.setBaseDAO(merchantimgsDao);
		}

		@Override
		public void addOrEditMerchantlogo(ImgsObj merchanimgsObj,Long merchantId) {
			// TODO Auto-generated method stub
			Merchantimgs merchantimgs=null;
			if (merchanimgsObj.getId()!=null) {
				merchantimgs=merchantimgsDao.get(merchanimgsObj.getId());
				merchanimgsObj.setImg(merchanimgsObj.getImg());
				merchanimgsObj.setDelStatus(merchanimgsObj.getDelStatus());
			}else {
				merchantimgs=new Merchantimgs(merchantId, 0, merchanimgsObj.getImg());
			}
			merchantimgsDao.saveOrUpdate(merchantimgs);
		}
}